import os
from cryptography.fernet import Fernet

def generate_and_save_key(file_path):
  key = Fernet.generate_key()
  with open(file_path, "wb") as file:
    file.write(key)

def load_key_from_file(file_path):
  if not os.path.isfile(file_path):
    print(f"Key file '{file_path}' does not exist.")
    return None
  with open(file_path, "rb") as file:
    key = file.read()
  return key